#ifndef ERROR_LISTBOX_H
#define ERROR_LISTBOX_H

#include <afxwin.h>
#include <afxtempl.h>
#include "errrptr.h"

class CErrorListBox : public CListBox, public ErrorReporter
{
	class CErrorPosition {
		unsigned int m_uiRow;
		unsigned int m_uiCol;
	public:
		CErrorPosition(unsigned int uiRow = 0, unsigned int uiCol = 0)
			: m_uiRow(uiRow), m_uiCol(uiCol) { }
		unsigned int GetRow() { return m_uiRow; }
		unsigned int GetCol() { return m_uiCol; }
	};
	class CErrorDataArray : public CArray<CErrorPosition, CErrorPosition>
	{
	public:
		void AddErrorPosition(unsigned int uiRow, unsigned int uiCol)
		{
			CErrorPosition ep(uiRow, uiCol);
			Add(ep);
		}
	};
	CErrorDataArray m_eda;
public:
	virtual void reset();
	virtual void report(ErrorClassID errClsID, ErrorMessageID errMsgID = ERRORMSG_NEUTRAL, const char *message = "", unsigned int row = 0, unsigned int col = 0);
	void GetErrorPosition(int i, unsigned int *pX, unsigned int *pY);
};

#endif
